package com.xul.yygh.task.scheduled;

import com.xul.common.rabbit.constant.MqConst;
import com.xul.common.rabbit.service.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author xul
 * @create 2021-07-21 11:56
 */

@Component
/**
 * 定时任务
 */
@EnableScheduling
public class ScheduledTask {

    @Autowired
    private RabbitService rabbitService;

    /**
     * cron表达式 设置执行间隔
     * 每天8点执行方法 就医提醒  0 0 8 * *？
     * 测试方便 每隔30秒提醒
     */
    @Scheduled(cron = "0/30 * * * * ?")
    public void taskPatient(){
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK,MqConst.ROUTING_TASK_8,"");
    }
}
